/**
 * 
 */
package com.smarthome.common.exception;

import com.smarthome.domain.enums.SmsExceptionEnum;

/**
 * @author dhc
 * @date 2015年10月15日 下午9:09:27
 * @title
 */
public class SmsException extends AppException{

	private SmsExceptionEnum exception;
	private static final long serialVersionUID = 1L;
	public SmsException() {
		super();
	}
	
	public SmsException(Throwable cause,SmsExceptionEnum exception) {
		super(cause);
		//super(message);
		this.exception = exception;
	}
	
	public SmsException(SmsExceptionEnum exception) {
		//super(message);
		this.exception = exception;
	}

	public SmsException(String message) {
		super(message);
	}

	public SmsException(String message, Throwable cause) {
		super(message, cause);
	}

	@Override
	public String getMessage() {
		String message = super.getMessage();
		if(null != exception){
			message = exception.showMessage();
		}
		return message;
	}
	
	public SmsExceptionEnum getExceptionEnum() {
		if(null == exception) exception = SmsExceptionEnum.DEFAULT;
		return exception;
	}
	
	public SmsException(Throwable cause) {
		super(cause);
	}
}
